package org.jeecg.modules.experiment.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.course.entity.AstuCourse;
import org.jeecg.modules.experiment.entity.AstuExperiment;

import java.util.List;

/**
 * @Description: 实验表
 * @Author: jeecg-boot
 * @Date:   2020-11-05
 * @Version: V1.0
 */
public interface AstuExperimentMapper extends BaseMapper<AstuExperiment> {
    /**
     * 通过课程名称得到课程id
     * @param courseName
     * @return
     */
    @Select("select id from astu_course where course_name = #{courseName}")
     String selectCourseIdByCourseName(@Param("courseName") String courseName);

    //查询课程的名字  老师工号  和老师姓名
    @Select("select * from astu_course")
    List<AstuCourse> selectCourseNameAndTeacherNumberAndTeacherNumber();

    public boolean deleteByMainId(@Param("mainId") String mainId);

    public List<AstuExperiment> selectByMainId(@Param("mainId") String mainId);
    /**
     * 通过id得到实验号
     * @param id
     * @return
     */
    @Select("select experiment_serial_number from astu_experiment where id = #{id}")
    String selectExperimentNumberById(@Param("id") String id);

    /**
     * 获取所有的实验号
     * @return
     */
    List<AstuExperiment> selectAllExperimentNum();

    /**
     * 通过课程号和实验号查询实验信息
     * @param courseId
     * @param experimentSerialNumber
     * @return
     */
    AstuExperiment selectInfoByCourseNumAndExperimentNum(@Param("courseNumber") String courseId, @Param("experimentNumber") String experimentSerialNumber);
}
